Capital Gain Buy
Tracks a buy transaction for capital gain calculations, particularly average cost with long term and short term gains. Per U.S. IRS Publication 564, single-category average cost allocates to the earliest shares acquired first:
Even though you include all unsold shares of a fund in a single category to compute average basis, you may have both short-term and long-term gains or losses when you sell these shares. To determine your holding period, the shares disposed of are considered to be those acquired first.*
This class tracks how many shares of a particular buy transaction has already been allotted by one or more sale transactions, and also helps track the remaining average cost basis. Note that these objects should always be processed in date order. If the date provided to methods CapitalGainBuy.allot, CapitalGainBuy.getRemainingShares or CapitalGainBuy.setRemainingBasis were ever to go backwards in time, this could give incorrect results because of stock splits.
Properties
The remaining basis after the most recently-processed sale transaction.
The number of shares purchased in the buy transaction.
The total buy amount, in the investment account's currency (dollars, euro, etc.).